package sample.cluster.sample;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;

/**
 * @author liuyi
 * @date 2017/03/08 13:54
 */
public class SampleClusterNode2 {
    public static void main(String[] args) throws InterruptedException {
        Config config = ConfigFactory.parseString(
                "akka.remote.netty.tcp.port=" + "2552").withFallback(
                ConfigFactory.load());

        // Create an Akka system
        ActorSystem system = ActorSystem.create("ClusterSystem", config);

        // Create an actor that handles cluster domain events
//        system.actorOf(Props.create(SimpleClusterListener.class),
//                "clusterListener");
        ActorRef ref = system.actorOf(Props.create(SampleClusterListener.class), "node2CusterListener");
//        ActorRef ref = system.actorOf(Props.create(SampleClusterListener.class));
        System.out.println(ref.path());
        Thread.sleep(10000L);


//        system.awaitTermination();
        system.shutdown();
//        Cluster cluster = Cluster.get(system);
//        Cluster.get(system).down();
//        cluster.shutdown();

    }
}
